//
// Decompiled with: Decompiler.NET, Version=1.3.1.18439, Culture=neutral, PublicKeyToken=null, Version: 1.3.1.18439
// Decompilation Started at: 3/15/2009 10:21:18 PM
// Copyright 2003 - 2004, Jungle Creatures, Inc., All Rights Reserved. 
// Written by Jonathan Pierce, Email: support@junglecreatures.com
//

namespace Utility

{
		
		#region Namespace Import Declarations
		
			using System.Collections;
			using System.Collections.Specialized;
			using System.ComponentModel;
			using System.Configuration;
			using System.Data;
			using System.Data.Common;
			using System.Data.OleDb;
			using System;
			
		#endregion
		
	public class Database_For_Ole
	
	{
		
		#region Fields
			private OleDbConnection con;
			private static Database_For_Ole DBCom;
		#endregion
		
		#region Nested Types
		
			[System.Serializable()]
			public enum custom
			
			{
				_DBCom = 0, 
			}
			
		#endregion
		
		#region Constructors
		
			static Database_For_Ole ()
			
			{
				Database_For_Ole.DBCom = ((Database_For_Ole) null);
				return;
			}
			
			
			public Database_For_Ole ()
			
			{
				return;
			}
			
		#endregion
		
		#region Properties
		
			public static Database_For_Ole _DBCom
			
			{
				get
				{
					Database_For_Ole theDatabase_For_Ole;
					if (Database_For_Ole.DBCom != null)
					{
						goto L_0011;
					}
					Database_For_Ole.DBCom = new Database_For_Ole ();
					
				L_0011:
					
					{
					}
					theDatabase_For_Ole = Database_For_Ole.DBCom;
					goto L_0019;
					
				L_0019:
					
					{
					}
					return theDatabase_For_Ole;
				}
			}
			
		#endregion
		
		#region Methods
		
			public OleDbConnection CreateConnections (string oleConnections)
			
			{
				OleDbConnection theOleDbConnection;
				this.con = new OleDbConnection (ConfigurationSettings.AppSettings["dsn"]);
				theOleDbConnection = this.con;
				goto L_0023;
				
			L_0023:
				
				{
				}
				return theOleDbConnection;
			}
			
			public DataSet Exc_Query (string selectString)
			
			{
				DataSet theDataSet;
				OleDbDataAdapter theOleDbDataAdapter;
				Exception theException;
				DataSet theDataSet2;
				
			L_0000:
				try
				{
					theDataSet = new DataSet ();
					theOleDbDataAdapter = new OleDbDataAdapter (selectString, this.con);
					int i = theOleDbDataAdapter.Fill (theDataSet);
					theOleDbDataAdapter.Dispose ();
					this.con.Close ();
					theDataSet2 = theDataSet;
				}
				catch (Exception theException2)
				{
					
				L_0030:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_003D:
				
				{
				}
				return theDataSet2;
			}
			
			public int Excu_NonQuery (string selectString)
			
			{
				OleDbCommand theOleDbCommand;
				int i;
				Exception theException;
				int i2;
				
			L_0000:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (selectString, this.con);
					i = theOleDbCommand.ExecuteNonQuery ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					i2 = i;
				}
				catch (Exception theException2)
				{
					
				L_0034:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_0041:
				
				{
				}
				return i2;
			}
			
			public int ExecuteNonQueryWithParam (string ole, string[] paramNames, object[] paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				int i3;
				Exception theException;
				int i4;
				if (paramNames == null)
				{
					goto L_0006;
				}
				if (paramValues != null)
				{
					goto L_000E;
				}
				
			L_0006:
				
				{
				}
				i4 = -1;
				goto L_0099;
				
			L_000E:
				
				{
				}
				i = Math.Min (paramNames.Length, paramValues.Length);
				if (i != 0)
				{
					goto L_0022;
				}
				i4 = 0;
				goto L_0099;
				
			L_0022:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i2 = 0;
					goto L_0067;
					
				L_003E:
					
					{
					}
					
				L_0050:
					
					{
					}
					
				L_004D:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value));
					OleDbParameter theOleDbParameter2 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_0067:
					
					{
					}
					if (i2 < i)
					{
						goto L_003E;
					}
					i3 = theOleDbCommand.ExecuteNonQuery ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					i4 = i3;
				}
				catch (Exception theException2)
				{
					
				L_008A:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_0099:
				
				{
				}
				return i4;
			}
			
			public int ExecuteNonQueryWithParam (string ole, string[] paramNames, OleDbType[] paramTypes, object[] paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				int i3;
				Exception theException;
				int i4;
				if (paramNames == null)
				{
					goto L_000A;
				}
				if (paramTypes == null)
				{
					goto L_000A;
				}
				if (paramValues != null)
				{
					goto L_0015;
				}
				
			L_000A:
				
				{
				}
				throw new Exception ("Database: Invalid parameter!");
				
			L_0015:
				
				{
				}
				i = Math.Min (paramNames.Length, paramTypes.Length);
				i = Math.Min (i, paramValues.Length);
				if (i != 0)
				{
					goto L_003A;
				}
				throw new Exception ("Database: Invalid parameter!");
				
			L_003A:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i2 = 0;
					goto L_008A;
					
				L_0056:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], paramTypes[i2]);
					
				L_0074:
					
					{
					}
					
				L_0070:
					
					{
					}
					theOleDbParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
					OleDbParameter theOleDbParameter2 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_008A:
					
					{
					}
					if (i2 < i)
					{
						goto L_0056;
					}
					i3 = theOleDbCommand.ExecuteNonQuery ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					i4 = i3;
				}
				catch (Exception theException2)
				{
					
				L_00AD:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_00BC:
				
				{
				}
				return i4;
			}
			
			public DataSet ExecuteQueryWithParam (string ole, string[] paramNames, OleDbType[] paramTypes, object[] paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				OleDbDataAdapter theOleDbDataAdapter;
				DataSet theDataSet;
				Exception theException;
				DataSet theDataSet2;
				if (paramNames == null)
				{
					goto L_000A;
				}
				if (paramTypes == null)
				{
					goto L_000A;
				}
				if (paramValues != null)
				{
					goto L_0012;
				}
				
			L_000A:
				
				{
				}
				theDataSet2 = ((DataSet) null);
				goto L_00D6;
				
			L_0012:
				
				{
				}
				i = Math.Min (paramNames.Length, paramTypes.Length);
				i = Math.Min (i, paramValues.Length);
				if (i != 0)
				{
					goto L_0034;
				}
				theDataSet2 = ((DataSet) null);
				goto L_00D6;
				
			L_0034:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i2 = 0;
					goto L_0084;
					
				L_0050:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], paramTypes[i2]);
					
				L_006E:
					
					{
					}
					
				L_006A:
					
					{
					}
					theOleDbParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
					OleDbParameter theOleDbParameter2 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_0084:
					
					{
					}
					if (i2 < i)
					{
						goto L_0050;
					}
					theOleDbDataAdapter = new OleDbDataAdapter (theOleDbCommand);
					theOleDbDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
					theDataSet = new DataSet ();
					int i3 = theOleDbDataAdapter.Fill (theDataSet);
					theOleDbDataAdapter.Dispose ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					theDataSet2 = theDataSet;
				}
				catch (Exception theException2)
				{
					
				L_00C7:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_00D6:
				
				{
				}
				return theDataSet2;
			}
			
			public DataSet ExecuteQueryWithParam (string ole, string[] paramNames, object[] paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				OleDbDataAdapter theOleDbDataAdapter;
				DataSet theDataSet;
				Exception theException;
				DataSet theDataSet2;
				if (paramNames == null)
				{
					goto L_0006;
				}
				if (paramValues != null)
				{
					goto L_000E;
				}
				
			L_0006:
				
				{
				}
				theDataSet2 = ((DataSet) null);
				goto L_00B4;
				
			L_000E:
				
				{
				}
				i = Math.Min (paramNames.Length, paramValues.Length);
				if (i != 0)
				{
					goto L_0025;
				}
				theDataSet2 = ((DataSet) null);
				goto L_00B4;
				
			L_0025:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i2 = 0;
					goto L_006A;
					
				L_0041:
					
					{
					}
					
				L_0053:
					
					{
					}
					
				L_0050:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value));
					OleDbParameter theOleDbParameter2 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_006A:
					
					{
					}
					if (i2 < i)
					{
						goto L_0041;
					}
					theOleDbDataAdapter = new OleDbDataAdapter (theOleDbCommand);
					theDataSet = new DataSet ();
					int i3 = theOleDbDataAdapter.Fill (theDataSet);
					theOleDbDataAdapter.Dispose ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					theDataSet2 = theDataSet;
				}
				catch (Exception theException2)
				{
					
				L_00A5:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_00B4:
				
				{
				}
				return theDataSet2;
			}
			
			public object ExecuteScalar (string sqlSelect)
			
			{
				OleDbCommand theOleDbCommand;
				object theObject;
				Exception theException;
				object theObject2;
				
			L_0000:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (sqlSelect, this.con);
					theObject = theOleDbCommand.ExecuteScalar ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					theObject2 = theObject;
				}
				catch (Exception theException2)
				{
					
				L_0034:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_0041:
				
				{
				}
				return theObject2;
			}
			
			public object ExecuteScalarWithParam (string ole, string[] paramNames, object[] paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				object theObject;
				Exception theException;
				object theObject2;
				if (paramNames == null)
				{
					goto L_0006;
				}
				if (paramValues != null)
				{
					goto L_0013;
				}
				
			L_0006:
				
				{
				}
				theObject2 = false;
				goto L_00A3;
				
			L_0013:
				
				{
				}
				i = Math.Min (paramNames.Length, paramValues.Length);
				if (i != 0)
				{
					goto L_002C;
				}
				theObject2 = false;
				goto L_00A3;
				
			L_002C:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i2 = 0;
					goto L_0071;
					
				L_0048:
					
					{
					}
					
				L_005A:
					
					{
					}
					
				L_0057:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value));
					OleDbParameter theOleDbParameter2 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_0071:
					
					{
					}
					if (i2 < i)
					{
						goto L_0048;
					}
					theObject = theOleDbCommand.ExecuteScalar ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					theObject2 = theObject;
				}
				catch (Exception theException2)
				{
					
				L_0094:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_00A3:
				
				{
				}
				return theObject2;
			}
			
			public object ExecuteScalarWithParam (string ole, string[] paramNames, OleDbType[] paramTypes, object[] paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				object theObject;
				Exception theException;
				object theObject2;
				if (paramNames == null)
				{
					goto L_000A;
				}
				if (paramTypes == null)
				{
					goto L_000A;
				}
				if (paramValues != null)
				{
					goto L_0017;
				}
				
			L_000A:
				
				{
				}
				theObject2 = false;
				goto L_00C0;
				
			L_0017:
				
				{
				}
				i = Math.Min (paramNames.Length, paramTypes.Length);
				i = Math.Min (i, paramValues.Length);
				if (i != 0)
				{
					goto L_003E;
				}
				theObject2 = false;
				goto L_00C0;
				
			L_003E:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i2 = 0;
					goto L_008E;
					
				L_005A:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], paramTypes[i2]);
					
				L_0078:
					
					{
					}
					
				L_0074:
					
					{
					}
					theOleDbParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
					OleDbParameter theOleDbParameter2 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_008E:
					
					{
					}
					if (i2 < i)
					{
						goto L_005A;
					}
					theObject = theOleDbCommand.ExecuteScalar ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
					theObject2 = theObject;
				}
				catch (Exception theException2)
				{
					
				L_00B1:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_00C0:
				
				{
				}
				return theObject2;
			}
			
			public int ExecuteSerialNonQueryWithParam (string ole, string[] paramNames, ArrayList paramValues)
			
			{
				OleDbCommand theOleDbCommand;
				int i;
				OleDbParameter theOleDbParameter;
				int i2;
				int i3;
				object[] theObjectArray;
				OleDbParameter theOleDbParameter2;
				Exception theException;
				int i4;
				IEnumerator theIEnumerator;
				IEnumerator theIEnumerator2;
				IDisposable theIDisposable;
				IDisposable theIDisposable2;
				if (paramNames == null)
				{
					goto L_0013;
				}
				if (paramValues == null)
				{
					goto L_0013;
				}
				if (paramNames.Length == 0)
				{
					goto L_0013;
				}
				if (paramValues.Count != 0)
				{
					goto L_001E;
				}
				
			L_0013:
				
				{
				}
				throw new Exception ("Database: Invalid parameter!");
				
			L_001E:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i = 0;
					goto L_005A;
					
				L_003A:
					
					{
					}
					theOleDbParameter = new OleDbParameter ();
					theOleDbParameter.ParameterName = paramNames[i];
					OleDbParameter theOleDbParameter3 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i++;
					
				L_005A:
					
					{
					}
					if (i < paramNames.Length)
					{
						goto L_003A;
					}
					i2 = 0;
					theIEnumerator = paramValues.GetEnumerator ();
					
				L_006A:
					try
					{
						goto L_00E5;
						
					L_006C:
						
						{
						}
						theObjectArray = ((object[]) theIEnumerator.Current);
						i3 = 0;
						theIEnumerator2 = theOleDbCommand.Parameters.GetEnumerator ();
						
					L_008A:
						try
						{
							goto L_00BA;
							
						L_008C:
							
							{
							}
							theOleDbParameter2 = ((OleDbParameter) theIEnumerator2.Current);
							
						L_00AF:
							
							{
							}
							
						L_00AA:
							
							{
							}
							theOleDbParameter2.Value = ((theObjectArray[i3] != null) ? theObjectArray[i3] : DBNull.Value);
							i3++;
							
						L_00BA:
							
							{
							}
							if (theIEnumerator2.MoveNext ())
							{
								goto L_008C;
							}
						}
						finally
						{
							
						L_00C5:
							
							{
							}
							theIDisposable = (theIEnumerator2 as IDisposable);
							if (theIDisposable == null)
							{
								goto L_00D9;
							}
							theIDisposable.Dispose ();
							
						L_00D9:
							
							{
							}
						}
						
					L_00DA:
						
						{
						}
						int i5 = theOleDbCommand.ExecuteNonQuery ();
						i2++;
						
					L_00E5:
						
						{
						}
						if (theIEnumerator.MoveNext ())
						{
							goto L_006C;
						}
					}
					finally
					{
						
					L_00F3:
						
						{
						}
						theIDisposable2 = (theIEnumerator as IDisposable);
						if (theIDisposable2 == null)
						{
							goto L_0107;
						}
						theIDisposable2.Dispose ();
						
					L_0107:
						
						{
						}
					}
					
				L_0108:
					
					{
					}
					theOleDbCommand.Dispose ();
					this.con.Close ();
					i4 = i2;
				}
				catch (Exception theException2)
				{
					
				L_011E:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_012D:
				
				{
				}
				return i4;
			}
			
			public int ExecuteSerialNonQueryWithParam (string ole, string[] paramNames, OleDbType[] paramTypes, ArrayList paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				int i3;
				int i4;
				object[] theObjectArray;
				OleDbParameter theOleDbParameter2;
				Exception theException;
				int i5;
				IEnumerator theIEnumerator;
				IEnumerator theIEnumerator2;
				IDisposable theIDisposable;
				IDisposable theIDisposable2;
				if (paramNames == null)
				{
					goto L_000A;
				}
				if (paramTypes == null)
				{
					goto L_000A;
				}
				if (paramValues != null)
				{
					goto L_0015;
				}
				
			L_000A:
				
				{
				}
				throw new Exception ("Database: Invalid parameter!");
				
			L_0015:
				
				{
				}
				i = Math.Min (paramNames.Length, paramTypes.Length);
				if (i == 0)
				{
					goto L_002D;
				}
				if (paramValues.Count != 0)
				{
					goto L_0038;
				}
				
			L_002D:
				
				{
				}
				throw new Exception ("Database: Invalid parameter!");
				
			L_0038:
				try
				{
					this.con.Open ();
					theOleDbCommand = new OleDbCommand (ole, this.con);
					i2 = 0;
					goto L_0071;
					
				L_0054:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], paramTypes[i2]);
					OleDbParameter theOleDbParameter3 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_0071:
					
					{
					}
					if (i2 < i)
					{
						goto L_0054;
					}
					i3 = 0;
					theIEnumerator = paramValues.GetEnumerator ();
					
				L_0081:
					try
					{
						goto L_00FE;
						
					L_0083:
						
						{
						}
						theObjectArray = ((object[]) theIEnumerator.Current);
						i4 = 0;
						theIEnumerator2 = theOleDbCommand.Parameters.GetEnumerator ();
						
					L_00A1:
						try
						{
							goto L_00D1;
							
						L_00A3:
							
							{
							}
							theOleDbParameter2 = ((OleDbParameter) theIEnumerator2.Current);
							
						L_00C6:
							
							{
							}
							
						L_00C1:
							
							{
							}
							theOleDbParameter2.Value = ((theObjectArray[i4] != null) ? theObjectArray[i4] : DBNull.Value);
							i4++;
							
						L_00D1:
							
							{
							}
							if (theIEnumerator2.MoveNext ())
							{
								goto L_00A3;
							}
						}
						finally
						{
							
						L_00DC:
							
							{
							}
							theIDisposable = (theIEnumerator2 as IDisposable);
							if (theIDisposable == null)
							{
								goto L_00F0;
							}
							theIDisposable.Dispose ();
							
						L_00F0:
							
							{
							}
						}
						
					L_00F1:
						
						{
						}
						int i6 = theOleDbCommand.ExecuteNonQuery ();
						i3++;
						
					L_00FE:
						
						{
						}
						if (theIEnumerator.MoveNext ())
						{
							goto L_0083;
						}
					}
					finally
					{
						
					L_010C:
						
						{
						}
						theIDisposable2 = (theIEnumerator as IDisposable);
						if (theIDisposable2 == null)
						{
							goto L_0120;
						}
						theIDisposable2.Dispose ();
						
					L_0120:
						
						{
						}
					}
					
				L_0121:
					
					{
					}
					theOleDbCommand.Dispose ();
					this.con.Close ();
					i5 = i3;
				}
				catch (Exception theException2)
				{
					
				L_0138:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_0147:
				
				{
				}
				return i5;
			}
			
			public void ExecuteStoredProc (string storeName, string[] paramNames, OleDbType[] paramTypes, object[] paramValues)
			
			{
				int i;
				OleDbCommand theOleDbCommand;
				int i2;
				OleDbParameter theOleDbParameter;
				Exception theException;
				i = Math.Min (paramNames.Length, paramTypes.Length);
				i = Math.Min (i, paramValues.Length);
				
			L_0017:
				try
				{
					theOleDbCommand = new OleDbCommand (storeName, this.con);
					theOleDbCommand.CommandType = CommandType.StoredProcedure;
					i2 = 0;
					goto L_0063;
					
				L_002F:
					
					{
					}
					theOleDbParameter = new OleDbParameter (paramNames[i2], paramTypes[i2]);
					
				L_004D:
					
					{
					}
					
				L_0049:
					
					{
					}
					theOleDbParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
					OleDbParameter theOleDbParameter2 = theOleDbCommand.Parameters.Add (theOleDbParameter);
					i2++;
					
				L_0063:
					
					{
					}
					if (i2 < i)
					{
						goto L_002F;
					}
					this.con.Open ();
					int i3 = theOleDbCommand.ExecuteNonQuery ();
					theOleDbCommand.Dispose ();
					this.con.Close ();
				}
				catch (Exception theException2)
				{
					
				L_008C:
					theException = theException2;
					throw new Exception (theException.Message);
				}
				
			L_009B:
				return;
			}
			
		#endregion
	}
	
}

